package com.chapala.interviewquestions;

import java.util.AbstractMap;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

public class FixedSize {
	private enum Sex {
		MALE, FEMALE
	}

	public static void main(String[] args) {
		System.out.print(size(new HashMap<Sex, Sex>()) + " ");
		System.out.print(size(new EnumMap<Sex, Sex>(Sex.class)));
	}

	private static int size(Map<Sex, Sex> map) {
		map.put(Sex.MALE, Sex.FEMALE);
		map.put(Sex.FEMALE, Sex.MALE);
		map.put(Sex.MALE, Sex.MALE);
		map.put(Sex.FEMALE, Sex.FEMALE);
		Set<Map.Entry<Sex, Sex>> set = new HashSet<Map.Entry<Sex, Sex>>();
		for (Map.Entry<Sex, Sex> e : map.entrySet())
			set.add(new AbstractMap.SimpleImmutableEntry<Sex, Sex>(e));
		return set.size();
	}

}